package com.hqu.ms;

import com.actionbarsherlock.app.ActionBar;
import com.actionbarsherlock.app.SherlockFragment;
import com.actionbarsherlock.view.Menu;
import com.actionbarsherlock.view.MenuInflater;
import com.actionbarsherlock.view.MenuItem;
import com.googlecode.androidannotations.annotations.AfterViews;
import com.googlecode.androidannotations.annotations.EFragment;


@EFragment(R.layout.ms_about_fragment)
public class AboutFragment extends SherlockFragment {
	
	@AfterViews
	void afterViewInjected(){
		setHasOptionsMenu(true);
	}
	
	
	@Override
	public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
		ActionBar bar = getSherlockActivity().getSupportActionBar();
		bar.setBackgroundDrawable(getResources().getDrawable(
				R.drawable.titlebar_background));
		bar.setHomeButtonEnabled(true);
		bar.setDisplayUseLogoEnabled(true);
		bar.setDisplayOptions(ActionBar.DISPLAY_HOME_AS_UP,
				ActionBar.DISPLAY_HOME_AS_UP | ActionBar.DISPLAY_SHOW_TITLE);
		super.onCreateOptionsMenu(menu, inflater);
	}
	
	
	@Override
	public boolean onOptionsItemSelected(MenuItem item) {
		switch (item.getItemId()) {
		case android.R.id.home:
			((AboutUsActivity)getActivity()).finishThis();
			break;

		default:
			break;
		}
		return super.onOptionsItemSelected(item);
	}
}
